package com.neusoft.lohas.modules.ivm.entity.product;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.neusoft.lohas.common.persistence.IdEntity;
import com.neusoft.lohas.modules.ivm.entity.merchant.Merchant;

/**
 * 商品出库记录Entity
 * 
 * @author Jackie.Liu
 * @version 2015-01-05
 */
@Entity
@Table(name = "ivm_product_out_detail")
@DynamicInsert
@DynamicUpdate
public class ProductOutDetail extends IdEntity<ProductOutDetail> {

	private static final long serialVersionUID = 1L;
	private Merchant merchant; // 所属商户
	private Product product; // 所属商品
	private int weight; // 出库量
	private int number; //出库份数(销售单位)
	private double amount; // 出库金额
	private String type; //出库类型：0普通出库，1市场支出，2客户退订，3采购耗损

	public ProductOutDetail() {
		super();
	}

	public ProductOutDetail(String id) {
		this();
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="merchant_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@NotNull(message="归属商户不能为空")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	@ManyToOne
	@JoinColumn(name = "product_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@NotNull(message="所属商品不能为空")
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public double getAmount() {
		return amount;
	}

	public void setAmount(double amount) {
		this.amount = amount;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

}
